<template>
	<view class="compose_result">
		<view class="close" @click="$emit('close')">
			<image :src="`${baseImageUrl}/common/close1.png`"></image>
		</view>
		<view class="title">
			<view>
				<image :src="`${baseImageUrl}/common/zw.png`"></image>
				<text>恭喜获得</text>
				<image :src="`${baseImageUrl}/common/zw.png`"></image>
			</view>
		</view>
		<image :src="`${baseImageUrl}/add/l3.gif`" class="apng" v-if="apng"></image>
		<view class="content">
			<image :src="cover"></image>
			<view class="tips">恭喜你获得:</view>
			<view class="name">{{name}}!</view>
		</view>
		<view class="btn" @click="$emit('close')">确定</view>
	</view>
</template>

<script>
	export default {
		props: {
			cover: {
				type: String,
				default: ""
			},
			name: {
				type: String,
				default: ""
			}
		},
		data() {
			return {
				apng: false,
				timer: null
			}
		},
		created() {
			this.apng = true;
			this.timer = setTimeout(() => {
				this.apng = false;
			}, 2 * 1000);
		},
		destroyed() {
			clearTimeout(this.timer)
		}
	}
</script>

<style scoped lang="scss">
	.compose_result {
		width: 688rpx;
		height: 606rpx;
		padding: 55rpx 60rpx 70rpx;
		box-sizing: border-box;
		background: url(#{$baseImageUrl}/bg/688_606.png) no-repeat;
		background-size: 100% 100%;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: center;
		position: relative;

		.close {
			width: 122rpx;
			height: 122rpx;
			position: absolute;
			right: 0rpx;
			top: 0rpx;
			transform: translate(50rpx, -50rpx);
			z-index: 2;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.title {
			display: flex;
			justify-content: center;
			align-items: center;

			view {
				height: 30rpx;
				display: flex;
				align-items: center;

				image {
					width: 30rpx;
					height: 30rpx;
				}

				text {
					color: #494338;
					font-size: 42rpx;
					font-weight: 400;
					font-family: LiSu;
					margin: 0 10rpx;
				}
			}
		}

		.apng {
			width: 100%;
			height: 100%;
			position: absolute;
			right: 0rpx;
			top: 0rpx;
			z-index: 99;
		}

		.content {
			height: 320rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			align-items: center;

			image {
				width: 200rpx;
				height: 200rpx;
			}

			.tips {
				color: #494338;
				font-size: 32rpx;
				font-weight: 400;
				font-family: SimSun;
			}

			.name {
				color: #494338;
				font-size: 40rpx;
				font-weight: 400;
				font-family: LiSu;
			}
		}

		.btn {
			width: 204rpx;
			height: 74rpx;
			line-height: 74rpx;
			text-align: center;
			color: #FFFFFF;
			font-size: 30rpx;
			font-weight: 400;
			font-family: SimSun;
			background: url(#{$baseImageUrl}/common/btn.png) no-repeat;
			background-size: 100% 100%;
		}
	}
</style>